package tw.edu.tku.im.maze;
import org.json.JSONException;
import org.json.JSONObject;


public class LoginReqParser extends PacketParser {
   public static LoginReqParser INSTANCE = new LoginReqParser();
   
   private LoginReqParser() { }

   @Override
   public LoginReq parse(JSONObject jsonObj) throws JSONException {
      JSONObject loginData = jsonObj.getJSONObject("parameter");
      String userID = loginData.getString("userID");
      String password = loginData.getString("password");
      return new LoginReq(userID, password);
   }

   @Override
   public String acceptName() {
      return "login";
   }

}
